package com.ruijixiang.leetcode.everyday.leetcode2024.leetcode202410;

import java.util.HashMap;
import java.util.Map;

public class leetcode20241022 {
    /**
     *
     * @param hours
     * @return
     */
    public int countCompleteDayPairs(int[] hours){
        int[] count=new int[24];
        int ans=0;
        for(int hour : hours){
            count[hour%24]++;
        }
        for(int i=1;i<12;i++){
            ans+=count[i]*count[24-i];
        }
        return ans+count[0]*(count[0]-1)/2+count[12]*(count[12]-1)/2;
    }

    public static void main(String[] args){
        leetcode20241022 leetcode20241022=new leetcode20241022();
        int[] hours={12,12,30,24,24};
        int ans=leetcode20241022.countCompleteDayPairs(hours);
        System.out.println(ans);
    }
}
